package com.example.push.infa;

import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

import com.example.push.dto.UserInfoDTO;

import lombok.RequiredArgsConstructor;

@Component
@RequiredArgsConstructor
public class RemoteAPI {

    private final RestTemplate restTemplate;

    private final static String USER_INFO = "https://gitee.com/api/v5/user?access_token={access_token}";
    private final static String ACCESS_TOKEN = "99d8ee51dd6e38e77bc4f587c098095f";

    public ResponseEntity<UserInfoDTO> getUserInfo() {
        return restTemplate.getForEntity(USER_INFO, UserInfoDTO.class, ACCESS_TOKEN);
    }
}
